import os
from flask_script import Manager, Shell
from flask_migrate import Migrate, MigrateCommand
import sys

sys.path.append('.')
sys.path.append('..')
from app import create_app, db
from app.models import *

uapp = create_app(os.getenv('FLASK_CONFIG') or 'default')



manager = Manager(app)
migrate = Migrate(app,db)

def make_shell_context():
    return dict(app=app, db=db)

#添加数据库初始化命令
manager.add_command('db', MigrateCommand)

manager.add_command('shell', Shell(make_context=make_shell_context))

if __name__ == '__main__':
    # manager.run()
    app.run()
